// 产品接口
interface Product {
    void use();
}

// 产品A
class ProductA implements Product {
    @Override
    public void use() {
        System.out.println("使用产品A");
    }
}

// 产品B
class ProductB implements Product {
    @Override
    public void use() {
        System.out.println("使用产品B");
    }
}

// 抽象工厂接口
interface Factory {
    Product createProduct();
}

// 工厂A，生产产品A
class FactoryA implements Factory {
    @Override
    public Product createProduct() {
        return new ProductA();
    }
}

// 工厂B，生产产品B
class FactoryB implements Factory {
    @Override
    public Product createProduct() {
        return new ProductB();
    }
}

// 测试类
public class TestFactoryMethod {
    public static void main(String[] args) {
        Factory factoryA = new FactoryA();
        Product productA = factoryA.createProduct();
        productA.use(); // 输出：使用产品A

        Factory factoryB = new FactoryB();
        Product productB = factoryB.createProduct();
        productB.use(); // 输出：使用产品B
    }
}
